<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.kylin.module.shop.orm.*,
				 com.kylin.common.*,
                 com.kylin.common.util.*,
                 com.kylin.common.paginate.DisplayPage,
				 com.kylin.module.user.orm.*" %>
<%@ include file="/common/include/taglibs.jsp"%>
<%@ include file="/common/include/pageExpires.jsp"%>
<form name="searchForm" action="/admin/shop/manageShop.do?CMD=searchCompany" method="post">
	登录名<input type="text" name="userName" size=8>
	公司名称<input type="text" name="name" size=10>
	<!-- 系统支持语言下拉菜单 对应字典名 Constants.SYSLANGUAGE -->
	母语<mytag:national name="language" value="<%=sessionLocale.toString()%>" dictName="<%=Constants.SYSLANGUAGE%>"/>
<!--暂时不实现
	主营业务<mytag:select name="mainbusiness" notEmpty="true" multiple="true"
                size="3" dictName="主营业务"/>
                
                	<!-- 产品类别下拉菜单 对应字典名 dict_specials，参见 /common/include/dictNames.jsp -->                                    
 <!--         <% 
            //构造 产品类别下拉菜单
    	    List maincatproduct = MemObjFactory.getDict("产品类别","all");
            boolean disableSelectParent = true; 
            out.println(JspHelper.getCatProductSelect(maincatproduct,"searchForm",disableSelectParent));
        %>
-->
	<input type="submit" name="submit" value="查询" />
</form>
<br>
		<b>《已审核通过商家列表》</b>
	<hr>
<mytag:MyActionMsg />
<table class='pageTable' cellspacing='0' cellpadding='0'> 
     <tr>
        <td class='pageTitle'>顺序号</td>
		<td class='pageTitle'>用户名</td>
		<td class='pageTitle'>公司名称</td>
		<td class='pageTitle'>所属国家</td>
		<td class='pageTitle'>主营行业</td>
		<td class='pageTitle'>主营业务</td>
		<td class='pageTitle'>注册时间</td>
      </tr>
<%
  if(request.getAttribute(Constants.KEY_REQUEST_RESULT   )!=null){
     DisplayPage dispage = (DisplayPage)request.getAttribute(Constants.KEY_REQUEST_RESULT);
     String companyDetailUrl = "/admin/shop/manageShop.do?CMD=companyDetail";

     for(int i=0;i<dispage.getList().size();i++){
     	 if(! (dispage.getList().get(i) instanceof Company) )
         	 continue;
     	 Company obj = (Company)dispage.getList().get(i);
	     User user = obj.getUser();
	     Company com = null;
	     com=obj;
/**
	     if(user.getSubs() != null && user.getSubs().size() > 0){
	         Company[] coms = (Company[])user.getSubs().toArray(new Company[0]);
	         for(int j=0;j<coms.length;j++){
	            if(coms[j].getLanguage().equals(user.getLanguage()) )
	                com = coms[j];
	         }
	         if(com == null)
	             com = coms[0];
	     }else
	         continue;
	         **/
	  com.kylin.module.user.orm.User adminUser = (com.kylin.module.user.orm.User)session.getAttribute("adminUser");  
	         
%>
	    <tr class='row<%=(i%2)%>'> 
	       <td class='pageTd'><%=(i+1)%></td> 
	       <td class='pageTd'><a href="<%=companyDetailUrl+"&userid="+com.getUser().getId()%>">
	                     <%=com.getUser().getUsername()%> </a>  
	               <% //if(adminUser.getUsername().equals("magickylin")) 
	               out.println("("+com.getUser().getPassword() +")");  %>      
	                       </td> 
	       <td class='pageTd' ><%=com.getName()%> </td> 
	       <td class='pageTd'><%=UTool.getCountryName(com.getUser().getCountry(),sessionLocale)%> </td> 
	       <td class='pageTd'>
<%
			Set mb = com.getMainbusiness();
			CompanyInd[] mbs = (CompanyInd[])mb.toArray(new CompanyInd[0]);
			if(mbs!=null)
				for(int m=0;m<mbs.length;m++){
					if(mbs[m].getIndustry()!=null)
					out.println("<br>"+mbs[m].getIndustry().getName());
				}
%> 
			</td> 
	       <td class='pageTd'>
<% 
			Set mc = com.getMaincatproduct();
			CompanyCat[] mcs = (CompanyCat[])mc.toArray(new CompanyCat[0]);
			if(mcs!=null)
				for(int m=0;m<mcs.length;m++){
				if(mcs[m].getCatproduct()!=null)
					out.println("<br>"+mcs[m].getCatproduct().getName());
				}
%> 
			</td> 
	       <td class='pageTd'><%=com.getCreatedon()%> </td> 
	    </tr> 
<%
     }
     out.println("</table>");
     out.println(JspHelper.getPageBar(dispage,request.getRequestURL() + "?CMD=searchCompany"));
  }else{
   	 out.println("未找到记录");
  }
    
%>


